IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'spPrintQueue_Create')
	BEGIN
		PRINT 'Dropping Procedure spPrintQueue_Create'
		DROP  Procedure  spPrintQueue_Create
	END

GO

PRINT 'Creating Procedure spPrintQueue_Create'
GO
CREATE Procedure dbo.spPrintQueue_Create
	( 	  
		@FileName varchar(50), 
		@FilePath varchar(50), 
		@UserName varchar(50), 
		@PrinterName varchar(50), 
		@PrinterFileName varchar(50), 
		@PrintCopies int, 
		@Date DateTime = null, 
		@Printed bit = null, 
		@PrintedDate DateTime = null
	)
AS
  /* 
    ------------------------------------------------------------------------------
    - Change History
    - --------------
    - Date          Description
    ------------------------------------------------------------------------------
    - 10/4/2007    Initial version created
    ------------------------------------------------------------------------------
  */

	-- Declare the required variables

	-- Create the required new record
	INSERT INTO PrintQueue
	  (
		FileName,
			FilePath,
			UserName,
			PrinterName,
			PrinterFileName,
			PrintCopies,
			Date,
			Printed,
			PrintedDate	  
	  )
	VALUES
	  (
		@FileName,
			@FilePath,
			@UserName,
			@PrinterName,
			@PrinterFileName,
			@PrintCopies,
			@Date,
			@Printed,
			@PrintedDate
	  )

	-- Handle any errors
	IF @@ERROR != 0
	BEGIN
		RAISERROR('spPrintQueue_Create: Unable to Insert a new PrintQueue', 10, 1)
		RETURN
	END

	-- Return the newly created ID
	SELECT	@@IDENTITY AS 'PrintQueue_ID'

	-- Return to calling method
	RETURN 

GO
